<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>育聘智联 - 企业招聘平台</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        /* 强制蓝色边框，优先级最高 */
        .job-card {
            border: none !important;
            box-shadow:
                0 0 0 8px rgba(51,154,252,0.12), /* 外晕染蓝色，距离增大 */
                0 8px 32px rgba(0,0,0,0.13);
            position: relative;
            padding: 56px 48px;
        }
        .job-card::before {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: 32px;
            pointer-events: none;
            box-shadow: 0 0 0 4px rgba(51,154,252,0.18);
        }
        .job-card:hover {
            box-shadow:
                0 0 0 6px rgba(0,113,227,0.18),
                0 16px 48px rgba(0,113,227,0.18);
        }
        .ypzl-brand {
            display: flex;
            align-items: center;
            margin-bottom: 18px;
        }
        .ypzl-logo {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: linear-gradient(135deg, #0071e3 60%, #00c3a0 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            color: #fff;
            font-size: 18px;
            margin-right: 12px;
            box-shadow: 0 2px 8px rgba(0,113,227,0.12);
        }
        .ypzl-title {
            font-size: 18px;
            font-weight: 700;
            color: #0071e3;
            letter-spacing: 1px;
        }
        /* 保持原有样式不变 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        }

        body {
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
            overflow-x: hidden;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* 头部样式  */
        header {
            background: rgba(255, 255, 255, 0.92);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            position: sticky;
            top: 0;
            z-index: 1000;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            padding: 15px 0;
            box-shadow: 0 1px 10px rgba(0, 0, 0, 0.03);
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            display: flex;
            align-items: center;
            font-size: 26px;
            font-weight: 700;
            color: #000;
            text-decoration: none;
        }

        .logo i {
            margin-right: 12px;
            color: #0071e3;
        }

        .user-actions a {
            margin-left: 20px;
            text-decoration: none;
            color: #0071e3;
            font-weight: 500;
            padding: 10px 20px;
            border-radius: 12px;
            transition: all 0.3s;
        }

        .user-actions a:hover {
            background: rgba(0, 113, 227, 0.1);
        }

        .btn-primary {
            background: #0071e3;
            color: white !important;
            padding: 12px 24px !important;
        }

        .btn-primary:hover {
            background: #0062c4 !important;
        }

        /* 搜索区域样式 */
        .search-section {
            padding: 80px 0 50px;
            text-align: center;
            background: linear-gradient(to bottom, #f5f7fa, #e6ebf5);
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        }

        .search-section h1 {
            font-size: 48px;
            font-weight: 700;
            margin-bottom: 20px;
            color: #000;
            letter-spacing: -0.5px;
        }

        .search-section p {
            font-size: 22px;
            color: #666;
            margin-bottom: 40px;
            max-width: 700px;
            margin-left: auto;
            margin-right: auto;
        }

        /* 搜索表单样式 */
        .search-form {
            max-width: 800px;
            margin: 0 auto;
            background: #fff;
            border-radius: 16px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
            padding: 20px;
            display: flex;
            align-items: center;
            transition: box-shadow 0.3s;
        }

        .search-form:hover {
            box-shadow: 0 6px 30px rgba(0, 0, 0, 0.08);
        }

        .search-input {
            flex: 1;
            padding: 18px 20px;
            border: none;
            font-size: 18px;
            outline: none;
            border-radius: 12px;
            background: #f5f7fa;
        }

        .search-btn {
            background: #0071e3;
            color: white;
            border: none;
            padding: 18px 35px;
            border-radius: 12px;
            font-size: 18px;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.3s;
            margin-left: 15px;
        }

        .search-btn:hover {
            background: #0062c4;
        }

        /* 筛选器样式 */
        .filters {
            display: flex;
            justify-content: center;
            margin: 30px 0 40px;
            flex-wrap: wrap;
            gap: 15px;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
            min-width: 200px;
        }

        .filter-group label {
            font-size: 14px;
            color: #666;
            margin-bottom: 8px;
            font-weight: 500;
        }

        .filter-select {
            padding: 16px 20px;
            border: 1px solid #e0e0e0;
            border-radius: 12px;
            font-size: 16px;
            background: white;
            appearance: none;
            background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
            background-repeat: no-repeat;
            background-position: right 1rem center;
            background-size: 1em;
            cursor: pointer;
        }

        .filter-select:focus {
            border-color: #0071e3;
            outline: none;
        }

        /* 职位列表样式 */
        .jobs-section {
            padding: 40px 0 80px;
        }

        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
        }

        .section-title {
            font-size: 32px;
            font-weight: 700;
        }

        .view-all {
            color: #0071e3;
            text-decoration: none;
            font-weight: 500;
            font-size: 18px;
        }

        .jobs-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 25px;
        }

        .job-cards {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 56px 48px;
            margin-top: 32px;
            margin-bottom: 0;
            width: 100%;
            min-height: 380px;
        }
        
        .job-card {
            box-sizing: border-box;
            width: 100%;
            min-width: 0;
            background: #fff;
            border-radius: 32px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.13);
            border: 2.5px solid #0071e3 !important;
            padding: 44px 36px;
            font-size: 22px;
            transition: box-shadow 0.25s, border-color 0.25s;
            cursor: pointer;
        }
        .job-card:hover {
            box-shadow: 0 16px 48px rgba(0,113,227,0.18);
        }
        .job-card:hover {
            box-shadow: 0 8px 32px rgba(0,0,0,0.18);
            transform: scale(1.04);
        }
        .job-card:hover {
            box-shadow: 0 4px 16px rgba(0,0,0,0.16);
        }
        .job-type {
            font-size: 15px;
            color: #0071e3;
            font-weight: bold;
        }
        .job-title {
            margin: 10px 0 8px 0;
        }
        .candidate-info {
            margin-top: 8px;
        }
        .info-item {
            margin-bottom: 6px;
            font-size: 15px;
        }
    /* .info-item 样式块结束，去除多余内容 */

        .job-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
        }

        .job-type {
            display: inline-block;
            padding: 6px 12px;
            background: #f0f7ff;
            color: #0071e3;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 500;
            margin-bottom: 20px;
        }

        .job-title {
            font-size: 22px;
            font-weight: 700;
            margin-bottom: 15px;
            color: #000;
        }

        .job-company {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
        }

        .company-logo {
            width: 50px;
            height: 50px;
            background: #f5f7fa;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 15px;
            font-size: 20px;
            color: #0071e3;
        }

        .company-info h3 {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 5px;
        }

        .company-info p {
            color: #666;
            font-size: 15px;
        }

        .candidate-info {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-top: 20px;
        }

        .info-item {
            display: flex;
            flex-direction: column;
        }

        .info-label {
            font-size: 13px;
            color: #888;
            margin-bottom: 5px;
        }

        .info-value {
            font-size: 16px;
            font-weight: 500;
        }

        .job-details {
            display: flex;
            justify-content: space-between;
            margin-top: 25px;
            padding-top: 20px;
            border-top: 1px solid #f0f0f0;
        }

        .salary {
            font-size: 20px;
            font-weight: 700;
            color: #000;
        }

        .job-location {
            display: flex;
            align-items: center;
            color: #666;
        }

        .job-location i {
            margin-right: 8px;
        }

        .detail-link {
            position: absolute;
            bottom: 30px;
            right: 30px;
            color: #0071e3;
            font-weight: 500;
            text-decoration: none;
            display: flex;
            align-items: center;
        }

        .detail-link i {
            margin-left: 5px;
            transition: transform 0.3s;
        }

        .job-card:hover .detail-link i {
            transform: translateX(3px);
        }

        /* 详情弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.6);
            z-index: 2000;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .modal.active {
            display: flex;
            opacity: 1;
        }

        .modal-content {
            background: white;
            border-radius: 24px;
            width: 90%;
            max-width: 800px;
            max-height: 90vh;
            overflow-y: auto;
            transform: scale(0.9);
            transition: transform 0.4s ease;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
        }

        .modal.active .modal-content {
            transform: scale(1);
        }

        .modal-header {
            padding: 30px 30px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #eee;
        }

        .modal-title {
            font-size: 28px;
            font-weight: 700;
        }

        .close-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #999;
            transition: color 0.3s;
        }

        .close-btn:hover {
            color: #333;
        }

        .modal-body {
            padding: 30px;
            position: relative;
        }

        .loading {
            display: none;
            text-align: center;
            padding: 40px;
            color: #666;
        }

        .loading i {
            font-size: 40px;
            margin-bottom: 20px;
            color: #0071e3;
        }

        .candidate-details {
            display: grid;
            grid-template-columns: 1fr 2fr;
            gap: 30px;
        }

        .candidate-photo {
            width: 100%;
            border-radius: 16px;
            overflow: hidden;
            background: #f5f7fa;
            height: 250px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 80px;
            color: #0071e3;
        }

        .candidate-info-detail {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 20px;
            margin-top: 20px;
        }

        .info-box {
            background: #f9f9f9;
            border-radius: 12px;
            padding: 20px;
        }

        .info-box h4 {
            margin-bottom: 15px;
            color: #0071e3;
        }

        .info-list {
            list-style: none;
        }

        .info-list li {
            margin-bottom: 10px;
            display: flex;
        }

        .info-list li span:first-child {
            font-weight: 500;
            min-width: 100px;
            color: #666;
        }

        .modal-footer {
            padding: 20px 30px;
            display: flex;
            justify-content: flex-end;
            border-top: 1px solid #eee;
        }

        .btn {
            padding: 12px 24px;
            border-radius: 12px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            border: none;
            font-size: 16px;
        }

        .btn-outline {
            background: white;
            border: 1px solid #0071e3;
            color: #0071e3;
            margin-right: 15px;
        }

        .btn-outline:hover {
            background: #f0f7ff;
        }

        .btn-contact {
            background: #0071e3;
            color: white;
        }

        .btn-contact:hover {
            background: #0062c4;
        }

        /* 页脚样式 */
        footer {
            background: #fff;
            padding: 50px 0 30px;
            border-top: 1px solid #f0f0f0;
        }

        .footer-content {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 30px;
        }

        .footer-column h3 {
            font-size: 18px;
            margin-bottom: 20px;
            color: #000;
            font-weight: 600;
        }

        .footer-column ul {
            list-style: none;
        }

        .footer-column ul li {
            margin-bottom: 15px;
        }

        .footer-column ul li a {
            text-decoration: none;
            color: #666;
            transition: color 0.3s;
        }

        .footer-column ul li a:hover {
            color: #0071e3;
        }

        .copyright {
            text-align: center;
            padding-top: 40px;
            color: #999;
            font-size: 14px;
        }

        /* 响应式设计 */
        @media (max-width: 900px) {
            .footer-content {
                grid-template-columns: repeat(2, 1fr);
            }

            .jobs-grid {
                grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            }

            .search-form {
                flex-direction: column;
            }

            .search-input {
                width: 100%;
                margin-bottom: 15px;
            }

            .search-btn {
                width: 100%;
                margin-left: 0;
            }

            .candidate-details {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 600px) {
            .filters {
                flex-direction: column;
            }

            .section-header {
                flex-direction: column;
                align-items: flex-start;
            }

            .view-all {
                margin-top: 15px;
            }

            .footer-content {
                grid-template-columns: 1fr;
            }

            .candidate-info {
                grid-template-columns: 1fr;
            }

            .candidate-info-detail {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <!-- 搜索结果弹窗 -->
    <div class="modal" id="searchModal">
        <div class="modal-content" style="max-width:600px;margin:80px auto;background:#fff;border-radius:18px;box-shadow:0 4px 24px #0071e344;padding:32px;">
            <div class="modal-header" style="display:flex;justify-content:space-between;align-items:center;">
                <h3 class="modal-title">搜索结果</h3>
                <button class="close-btn" onclick="closeSearchModal()" style="font-size:28px;background:none;border:none;cursor:pointer;">&times;</button>
            </div>
            <div class="modal-body" id="searchResultBody"></div>
        </div>
    </div>
        <!-- flash消息提示 -->
        {% with messages = get_flashed_messages() %}
            {% if messages %}
                <div class="flash-message" style="max-width:600px;margin:30px auto 0 auto;background:#f0f7ff;border-radius:12px;padding:18px 24px;color:#0071e3;font-size:18px;text-align:center;box-shadow:0 2px 8px rgba(0,113,227,0.08);">
                    {% for message in messages %}
                        <p>{{ message }}</p>
                    {% endfor %}
                </div>
            {% endif %}
        {% endwith %}
        <!-- 品牌元素 -->
        <div style="width:100%;background:linear-gradient(90deg,#0071e3 60%,#00c3a0 100%);padding:18px 0 10px 0;box-shadow:0 2px 12px rgba(0,113,227,0.08);">
            <div style="max-width:1200px;margin:0 auto;display:flex;align-items:center;">
                <div style="display:flex;align-items:center;">
                    <div style="width:48px;height:48px;border-radius:50%;background:#fff;display:flex;align-items:center;justify-content:center;margin-right:16px;box-shadow:0 2px 8px rgba(0,113,227,0.10);">
                        <span style="font-size:28px;font-weight:bold;color:#0071e3;">育</span>
                    </div>
                    <span style="font-size:26px;font-weight:700;color:#fff;letter-spacing:2px;">育聘智联</span>
                </div>
                <span style="margin-left:32px;font-size:18px;color:#e0f7fa;font-weight:500;">连接企业与顶尖人才，创新招聘新体验</span>
            </div>
        </div>
        <!-- 头部导航 -->
    <header>
        <div class="container">
            <div class="header-content">
                <a href="#" class="logo">
                    <i class="fas fa-graduation-cap"></i>
                    育聘智联
                </a>
                <div class="user-actions">
                    {% if session.get('username') %}
                        <span style="color:#0071e3;font-weight:500;margin-right:20px;">欢迎，{{ session['username'] }}</span>
                        <a href="/upload_resume" style="background:#0071e3;color:#fff;padding:10px 20px;border-radius:12px;margin-right:10px;text-decoration:none;">
                            <i class="fas fa-file-upload"></i> 上传简历
                        </a>
                        <a href="/logout"><i class="fas fa-sign-out-alt"></i> 退出登录</a>
                    {% else %}
                        <a href="/login"><i class="fas fa-sign-in-alt"></i> 登录</a>
                        <a href="/register"><i class="fas fa-user-plus"></i> 注册</a>
                        <a href="/upload_resume" style="background:#0071e3;color:#fff;padding:10px 20px;border-radius:12px;margin-left:10px;text-decoration:none;">
                            <i class="fas fa-file-upload"></i> 上传简历
                        </a>
                    {% endif %}
                </div>
            </div>
        </div>
    </header>

     <!-- 搜索区域 -->
    <section class="search-section">
        <div class="container">
            <h1>连接企业与顶尖人才</h1>
            <p>高效招聘解决方案，为企业提供精准匹配的专业人才</p>

            <form class="search-form" id="searchForm">
                <input type="text" class="search-input" name="query" placeholder="职位名称，技能关键词等" id="searchInput">
                <button type="submit" class="search-btn"><i class="fas fa-search"></i> 搜索人才</button>
            </form>
            <!-- 搜索加载提示，显示在搜索框下方 -->
            <div class="loading" id="searchLoading" style="margin-top:10px;">
                <i class="fas fa-spinner fa-spin"></i>
                <div>正在搜索中，请稍候...</div>
            </div>

            <div class="filters">
                <!-- 已删除职位类别、薪资范围、工作经验、工作地点筛选区 -->
            </div>
        </div>
    </section>

    <!-- 推荐人才卡片区 -->
    <section class="jobs-section">
        <div class="container" style="display: flex; flex-direction: column; min-height: 700px;">
            <div class="section-header">
                <h2 class="section-title">推荐人才</h2>
                <a href="/resumes" class="view-all">查看全部 <i class="fas fa-arrow-right"></i></a>
            </div>
            <div class="jobs-grid" style="flex: 1; display: flex;">
                <div class="job-cards" id="recommended-cards" style="flex: 1; align-items: stretch;"></div>
            </div>
        </div>
    </section>

    <!-- 详情弹窗 -->
    <div class="modal" id="jobModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">人才详情</h3>
                <button class="close-btn" onclick="closeModal()">&times;</button>
            </div>
            <div class="modal-body">
                <div class="candidate-details">
                    <div class="candidate-photo">
                        <i class="fas fa-user"></i>
                    </div>
                    <div>
                        <h3 id="detail-name"></h3>
                        <p id="detail-title"></p>
                        <div class="candidate-info-detail">
                            <div class="info-box">
                                <h4>基本信息</h4>
                                <ul class="info-list">
                                    <li><span>年龄：</span> <span id="detail-age"></span></li>
                                    <li><span>学历：</span> <span id="detail-education"></span></li>
                                    <li><span>工作经验：</span> <span id="detail-exp"></span></li>
                                    <li><span>所在地：</span> <span id="detail-location"></span></li>
                                </ul>
                            </div>
                            <div class="info-box">
                                <h4>薪资期望</h4>
                                <ul class="info-list">
                                    <li><span>期望薪资：</span> <span id="detail-salary"></span></li>
                                    <li><span>工作类型：</span> <span id="detail-type"></span></li>
                                    <li><span>到岗时间：</span> <span id="detail-time"></span></li>
                                </ul>
                            </div>
                            <div class="info-box">
                                <h4>专业技能</h4>
                                <ul class="info-list">
                                    <li><span>前端框架：</span> <span></span></li>
                                    <li><span>编程语言：</span> <span></span></li>
                                    <li><span>其他技能：</span> <span></span></li>
                                </ul>
                            </div>
                            <div class="info-box">
                                <h4>工作经历</h4>
                                <ul class="info-list">
                                    <li><span>2019-至今：</span> <span></span></li>
                                    <li><span>2017-2019：</span> <span></span></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-outline">收藏人才</button>
                <button class="btn btn-contact">立即沟通</button>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer>
        <div class="container">
            <div class="footer-content">
                <div class="footer-column">
                    <h3>育聘智联</h3>
                    <ul>
                        <li><a href="#">关于我们</a></li>
                        <li><a href="#">加入我们</a></li>
                        <li><a href="#">新闻中心</a></li>
                        <li><a href="#">社会责任</a></li>
                    </ul>
                </div>

                <div class="footer-column">
                    <h3>企业服务</h3>
                    <ul>
                        <li><a href="#">发布职位</a></li>
                        <li><a href="#">人才搜索</a></li>
                        <li><a href="#">招聘解决方案</a></li>
                        <li><a href="#">企业账户</a></li>
                    </ul>
                </div>

                <div class="footer-column">
                    <h3>帮助中心</h3>
                    <ul>
                        <li><a href="#">使用指南</a></li>
                        <li><a href="#">常见问题</a></li>
                        <li><a href="#">服务条款</a></li>
                        <li><a href="#">隐私政策</a></li>
                    </ul>
                </div>

                <div class="footer-column">
                    <h3>联系我们</h3>
                    <ul>
                        <li><a href="#">客服热线: 400-888-8888</a></li>
                        <li><a href="#">企业合作: partner@yupin.com</a></li>
                        <li><a href="#">媒体联系: press@yupin.com</a></li>
                        <li>
                            <div style="margin-top: 15px;">
                                <a href="#" style="font-size: 24px; margin-right: 15px;"><i class="fab fa-weixin"></i></a>
                                <a href="#" style="font-size: 24px; margin-right: 15px;"><i class="fab fa-weibo"></i></a>
                                <a href="#" style="font-size: 24px;"><i class="fab fa-linkedin"></i></a>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="copyright">
                <p>© 2023 育聘智联 Inc. 保留所有权利。沪ICP备12345678号</p>
            </div>
        </div>
    </footer>

    <script>
        function openSearchModal(results) {
            const modal = document.getElementById('searchModal');
            const body = document.getElementById('searchResultBody');
            if (!results.length) {
                body.innerHTML = '<div style="text-align:center;color:#888;font-size:18px;">未找到符合条件的简历</div>';
            } else {
                // 按id去重
                const unique = [];
                const ids = new Set();
                for (const c of results) {
                    if (!ids.has(c.id)) {
                        unique.push(c);
                        ids.add(c.id);
                    }
                }
                body.innerHTML = unique.map(candidate => `
                    <div style="border-bottom:1px solid #eee;padding:16px 0;">
                        <div style="font-size:17px;font-weight:700;color:#0071e3;">姓名：${candidate.name || '未知'}</div>
                        <div style="font-size:15px;color:#555;">岗位：${candidate.job || '未知'} | 学历：${candidate.education || '未知'} | 薪资：${candidate.salary || '未知'}</div>
                        <div style="font-size:15px;color:#0071e3;margin:4px 0;">匹配度：${candidate.match_score || 0}/100</div>
                        <div style="font-size:13px;color:#888;margin-bottom:4px;">${candidate.match_points && candidate.match_points.length ? '匹配点：' + candidate.match_points.join('，') : ''}</div>
                        <a href="/resume/${candidate.id}" style="color:#0071e3;text-decoration:underline;font-size:15px;">查看详情</a>
                    </div>
                `).join('');
            }
            modal.classList.add('active');
        }
        function closeSearchModal() {
            document.getElementById('searchModal').classList.remove('active');
        }
        function openModal(candidate) {
            const modal = document.getElementById('jobModal');
            modal.classList.add('active');
            document.getElementById('detail-name').textContent = candidate.filename;
            document.getElementById('detail-title').textContent = candidate.content;
            document.getElementById('detail-age').textContent = '';
            document.getElementById('detail-education').textContent = candidate.education;
            document.getElementById('detail-exp').textContent = candidate.experience;
            document.getElementById('detail-location').textContent = candidate.upload_time;
            document.getElementById('detail-salary').textContent = '';
            document.getElementById('detail-type').textContent = '';
            document.getElementById('detail-time').textContent = '';
        }
        function closeModal() {
            const modal = document.getElementById('jobModal');
            modal.classList.remove('active');
        }
        window.onclick = function(event) {
            const modal = document.getElementById('jobModal');
            if (event.target == modal) {
                closeModal();
            }
        }
        document.addEventListener('DOMContentLoaded', function() {
            document.getElementById('searchForm').addEventListener('submit', function(e) {
                e.preventDefault();
                document.getElementById('searchLoading').style.display = 'block'; // 显示加载提示
                const query = document.getElementById('searchInput').value.trim();
                fetch(`/api/recommended?query=${encodeURIComponent(query)}`)
                    .then(res => res.json())
                    .then(data => {
                        document.getElementById('searchLoading').style.display = 'none'; // 隐藏加载提示
                        if (!data.success) {
                            let errMsg = data.error ? data.error : '服务器异常或无响应';
                            openSearchModal([]);
                            document.getElementById('searchResultBody').innerHTML = `<div style='color:#d00;font-size:18px;text-align:center;'>${errMsg}</div>`;
                            return;
                        }
                        // 支持通过技能关键词检索人才
                        const skillKeywords = [
                            'python','java','javascript','sql','vue','react','c++','excel','ppt','数据分析','沟通','项目管理','团队','创新','领导力',
                            '开发','编程','后端','前端','测试','算法','分析','管理','设计','维护','优化','实施','运维','产品','运营','销售','市场','人力','招聘','培训',
                            '设计师','ui设计师','平面设计','视觉设计','交互设计','美工','美术','设计总监','高级设计师','资深设计师','网页设计','工业设计','室内设计','服装设计',
                            'designer','ui designer','graphic designer','visual designer','interaction designer','artist','design director','senior designer','web designer','industrial designer','interior designer','fashion designer'
                        ];
                        const results = data.candidates.filter(c => {
                            if (!query) return true;
                            const q = query.toLowerCase();
                            // 岗位字段
                            if (c.job && c.job.toLowerCase().includes(q)) return true;
                            // 简历内容全文包含关键词也命中
                            if (c.content && c.content.toLowerCase().includes(q)) return true;
                            if (c.ai_content && c.ai_content.toLowerCase().includes(q)) return true;
                            // 技能关键词匹配
                            for (const skill of skillKeywords) {
                                if (skill.includes(q) || q.includes(skill)) {
                                    if (c.content && c.content.toLowerCase().includes(skill)) return true;
                                    if (c.ai_content && c.ai_content.toLowerCase().includes(skill)) return true;
                                }
                            }
                            return false;
                        });
                        openSearchModal(results);
                    })
                    .catch(err => {
                        document.getElementById('searchLoading').style.display = 'none'; // 隐藏加载提示
                        openSearchModal([]);
                        document.getElementById('searchResultBody').innerHTML = `<div style='color:#d00;font-size:18px;text-align:center;'>请求失败：${err}</div>`;
                    });
            });
            fetch('/api/recommended')
                .then(res => res.json())
                .then(data => {
                    if (!data.success) return;
                    const cardsDiv = document.getElementById('recommended-cards');
                    cardsDiv.innerHTML = '';
                    // 仅显示前四个推荐卡片
                    const showCandidates = [];
                    const ids = new Set();
                    for (const c of data.candidates) {
                        if (showCandidates.length >= 4) break;
                        if (!ids.has(c.id)) {
                            showCandidates.push(c);
                            ids.add(c.id);
                        }
                    }
                    showCandidates.forEach((candidate, idx) => {
                        const card = document.createElement('div');
                        card.className = 'job-card';
                        card.onclick = () => {
                            window.location.href = `/resume/${candidate.id}`;
                        };
                        card.innerHTML = `
                            <div class="ypzl-brand" style="margin-top:18px;">
                                <img src="/static/微信图片_2025-08-24_230658_822.jpg" alt="育聘智联LOGO" style="height:28px;margin-right:10px;filter:drop-shadow(0 2px 8px #00c6fb44);">
                            </div>
                            <div style="text-align:center;margin-bottom:10px;">
                                <span style="font-size:15px;font-weight:700;color:#0071e3;letter-spacing:1px;">育聘智联</span>
                            </div>
                            <span class="job-type" style="font-size:13px;">${candidate.job || '意向岗位未知'}</span>
                            <h3 class="job-title" style="font-size:18px;">姓名：${candidate.name || '姓名未知'}</h3>
                            <div class="candidate-info" style="font-size:13px;">
                                <div class="info-item">
                                    <span class="info-label">年龄</span>
                                    <span class="info-value">${candidate.age || '未知'}</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">学历</span>
                                    <span class="info-value">${candidate.education || '未知'}</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">工作经验</span>
                                    <span class="info-value">${candidate.experience || '未知'}</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">期望薪资</span>
                                    <span class="info-value">${candidate.salary || '未知'}</span>
                                </div>
                            </div>
                            <div style="margin-top:10px;text-align:center;font-size:12px;color:#888;">详细内容请点击查看</div>
                        `;
                        cardsDiv.appendChild(card);
                    });
                });
        });
    </script>
</body>
    <footer style="margin-top:48px;text-align:center;color:#aaa;font-size:16px;">
    <img src="/static/微信图片_2025-08-24_230658_822.jpg" alt="育聘智联LOGO" style="height:28px;margin-bottom:6px;filter:drop-shadow(0 2px 8px #00c6fb44);">
        <div style="font-size:15px;color:#0071e3;font-weight:600;letter-spacing:1px;">育聘智联 · 智慧招聘平台</div>
        <div style="margin-top:8px;color:#aaa;font-size:14px;">&copy; 2025 育聘智联 YPZL. All Rights Reserved.</div>
    </footer>
</html>